<?php
class UserRole extends AppModel {
	var $name = 'UserRole';
	
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'User' => array(
			'className' => 'User',
			'foreignKey' => 'user_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Role' => array(
			'className' => 'Role',
			'foreignKey' => 'role_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
    
    function getAllRoles($user_id)
    {
        $records = $this->find('all',array('conditions'=>array('UserRole.user_id'=>$user_id)));
        return $this->covertArray($records,'UserRole','id','role_id');
    }
}
